package com.company.test22;

import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Scanner;
import java.util.TreeSet;

/**
 * Created by Administrator on 2016.9.28.
 */
public class Test2202 {
    public static void main(String[] args) throws IOException{
        TreeSet<String> words=read("src/com/company/test22/words.txt");

        System.out.println(words);
    }

    public static TreeSet<String> read(String address)throws IOException{
        File file=new File(address);

        Scanner input=new Scanner(file);
        HashSet<String> words=new HashSet<>();

        while (input.hasNext()){
            words.add(input.next());
        }

        return new TreeSet<>(words);
    }
}